//-----------------------------------------------------------------------
// <copyright file="tblInternalRateService.cs" company="Cyvee">
//     Copyright ? Cyvee. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using Scb.Framework;
using Robot.Entities;
using Robot.Data;
    
namespace Robot.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class tblInternalRateService
    {

      #region My Store procedure

      public static tblInternalRateCollection GettblInternalRateByFromFileID(Guid id)
      {
        try
        {
          tblInternalRateDAO tblInternalRateDAO = new tblInternalRateDAO();
          return tblInternalRateDAO.GettblInternalRateByFromFileID(id);
        }
        catch (BusinessException)
        {
          throw;
        }
        catch (Exception ex)
        {
          // log this exception
          Logger.Error(ex);
          // wrap it and rethrow
          throw new BusinessException(SR.BusinessGettblInternalRateListException, ex);
        }
      }

      public static tblInternalRate GetInternalRateByCurrency(string buyCCY, string sellCCY)
      {
        try
        {
          tblInternalRateDAO tblInternalRateDAO = new tblInternalRateDAO();
          return tblInternalRateDAO.GetInternalRateByCurrency(buyCCY,sellCCY);
        }
        catch (BusinessException)
        {
          throw;
        }
        catch (Exception ex)
        {
          // log this exception
          Logger.Error(ex);
          // wrap it and rethrow
          throw new BusinessException(SR.BusinessGettblInternalRateListException, ex);
        }
      }

      public static tblInternalRateCollection GettblInternalRateOnDay()
      {
        try
        {
          tblInternalRateDAO tblInternalRateDAO = new tblInternalRateDAO();
          return tblInternalRateDAO.GettblInternalRateOnDay();
        }
        catch (BusinessException)
        {
          throw;
        }
        catch (Exception ex)
        {
          // log this exception
          Logger.Error(ex);
          // wrap it and rethrow
          throw new BusinessException(SR.BusinessGettblInternalRateListException, ex);
        }
      }

      

      public static void DeletetblInternalRate(string peoplewise)
        {            
            try
            {
                tblInternalRateDAO tblInternalRateDAO = new tblInternalRateDAO();
                tblInternalRateDAO.DeletetblInternalRate(peoplewise);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeletetblInternalRateException, ex);
            }
        }
      

      #endregion
       
      #region tblInternalRate

      public static void CreatetblInternalRate(tblInternalRate tblInternalRate)
        {            
            try
            {
                tblInternalRateDAO tblInternalRateDAO = new tblInternalRateDAO();
                tblInternalRateDAO.CreatetblInternalRate(tblInternalRate);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreatetblInternalRateException, ex);
            }
        }        

        public static void UpdatetblInternalRate(tblInternalRate tblInternalRate)
        {            
            try
            {
                tblInternalRateDAO tblInternalRateDAO = new tblInternalRateDAO();
                tblInternalRateDAO.UpdatetblInternalRate(tblInternalRate);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdatetblInternalRateException, ex);
            }
        }        

        public static void DeletetblInternalRate(Guid id)
        {            
            try
            {
                tblInternalRateDAO tblInternalRateDAO = new tblInternalRateDAO();
                tblInternalRateDAO.DeletetblInternalRate(id);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeletetblInternalRateException, ex);
            }
        }
        
        public static tblInternalRate GettblInternalRate(Guid id)
        {            
            try
            {
                tblInternalRateDAO tblInternalRateDAO = new tblInternalRateDAO();
                return tblInternalRateDAO.GettblInternalRate(id);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGettblInternalRateException, ex);
            }
        }                

        public static tblInternalRateCollection GettblInternalRateList(tblInternalRateColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                tblInternalRateDAO tblInternalRateDAO = new tblInternalRateDAO();
                return tblInternalRateDAO.GettblInternalRateList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGettblInternalRateListException, ex);
            }
        }        

        public static tblInternalRateCollection GettblInternalRateList(tblInternalRateColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                tblInternalRateDAO tblInternalRateDAO = new tblInternalRateDAO();
                return tblInternalRateDAO.GettblInternalRateList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGettblInternalRateListException, ex);
            }
        }        

        #endregion
    }
}